<section class="content-header">
    <h1>{{edit ? "修改景区" : "创建景区"}}</h1>
</section>

<section class="content">
    <div class="box box-primary">
        <form class="form-horizontal" name="regions_creat_form" novalidate="novalidate" ng-submit="regionsCreatForm()">
            <div class="box-body">
                <div class="form-group pt7" ng-class="{'has-success': regions_creat_form.code.$dirty && regions_creat_form.code.$valid && !regions_creat_form.code.$focused, 'has-error': regions_creat_form.code.$dirty && regions_creat_form.code.$invalid && !regions_creat_form.code.$focused}">
                    <label for="code" class="col-sm-2 control-label">景区编号</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="code" name="code" ng-model="region.code" placeholder="景区编号" ng-focus required />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.name.$dirty && regions_creat_form.name.$valid && !regions_creat_form.name.$focused, 'has-error': regions_creat_form.name.$dirty && regions_creat_form.name.$invalid && !regions_creat_form.name.$focused}">
                    <label for="name" class="col-sm-2 control-label">景区名称</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="name" name="name" ng-model="region.name" placeholder="景区名称" ng-focus required />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.brief.$dirty && regions_creat_form.brief.$valid && !regions_creat_form.brief.$focused, 'has-error': regions_creat_form.brief.$dirty && regions_creat_form.brief.$invalid && !regions_creat_form.brief.$focused}">
                    <label for="brief" class="col-sm-2 control-label">景区简介</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="brief" name="brief" ng-model="region.brief" placeholder="景区简介" />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.amount.$dirty && regions_creat_form.amount.$valid && !regions_creat_form.amount.$focused, 'has-error': regions_creat_form.amount.$dirty && regions_creat_form.amount.$invalid && !regions_creat_form.amount.$focused}">
                    <label for="amount" class="col-sm-2 control-label">景区价格</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="amount" name="amount" ng-model="region.amount" placeholder="景区价格(单位：元)" ng-blur="fixAmount(region.amount)" />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.memo.$dirty && regions_creat_form.memo.$valid && !regions_creat_form.memo.$focused, 'has-error': regions_creat_form.memo.$dirty && regions_creat_form.memo.$invalid && !regions_creat_form.memo.$focused}">
                    <label for="memo" class="col-sm-2 control-label">预订文案</label>
                    <div class="col-sm-9">
                        <textarea class="form-control" id="memo" name="memo" ng-model="region.memo" placeholder="预订文案"></textarea>
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.address.$dirty && regions_creat_form.address.$valid && !regions_creat_form.address.$focused, 'has-error': regions_creat_form.address.$dirty && regions_creat_form.address.$invalid && !regions_creat_form.address.$focused}">
                    <label for="address" class="col-sm-2 control-label">景区地址</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="address" name="address" ng-model="region.address" placeholder="景区地址" />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.tel.$dirty && regions_creat_form.tel.$valid && !regions_creat_form.tel.$focused, 'has-error': regions_creat_form.tel.$dirty && regions_creat_form.tel.$invalid && !regions_creat_form.tel.$focused}">
                    <label for="tel" class="col-sm-2 control-label">景区电话</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="tel" name="tel" ng-model="region.tel" placeholder="景区电话" />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.tags.$dirty && regions_creat_form.tags.$valid && !regions_creat_form.tags.$focused, 'has-error': regions_creat_form.tags.$dirty && regions_creat_form.tags.$invalid && !regions_creat_form.tags.$focused}">
                    <label for="tags" class="col-sm-2 control-label">景区标签</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="tags" name="tags" ng-model="region.tags" placeholder="景区标签，用逗号分割" />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.public_time.$dirty && regions_creat_form.public_time.$valid && !regions_creat_form.public_time.$focused, 'has-error': regions_creat_form.public_time.$dirty && regions_creat_form.public_time.$invalid && !regions_creat_form.public_time.$focused}">
                    <label for="public_time" class="col-sm-2 control-label">开放时间</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="public_time" name="public_time" ng-model="region.public_time" placeholder="开放时间" />
                    </div>
                </div>
                <div class="form-group" ng-if="region.region_type == 1" ng-class="{'has-success': regions_creat_form.entrance_time.$dirty && regions_creat_form.entrance_time.$valid && !regions_creat_form.entrance_time.$focused, 'has-error': regions_creat_form.entrance_time.$dirty && regions_creat_form.entrance_time.$invalid && !regions_creat_form.entrance_time.$focused}">
                    <label for="entrance_time" class="col-sm-2 control-label">入园时间</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="entrance_time" name="entrance_time" ng-model="region.entrance_time" placeholder="入园时间" />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.company.$dirty && regions_creat_form.company.$valid && !regions_creat_form.company.$focused, 'has-error': regions_creat_form.company.$dirty && regions_creat_form.company.$invalid && !regions_creat_form.company.$focused}">
                    <label for="company" class="col-sm-2 control-label">所属公司</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="company" name="company" ng-model="region.company" placeholder="所属公司" />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.province.$dirty && regions_creat_form.province.$valid && !regions_creat_form.province.$focused, 'has-error': regions_creat_form.province.$dirty && regions_creat_form.province.$invalid && !regions_creat_form.province.$focused}">
                    <label for="province" class="col-sm-2 control-label">所在省</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="province" name="province" ng-model="region.province" placeholder="所在省" />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.city.$dirty && regions_creat_form.city.$valid && !regions_creat_form.city.$focused, 'has-error': regions_creat_form.city.$dirty && regions_creat_form.city.$invalid && !regions_creat_form.city.$focused}">
                    <label for="city" class="col-sm-2 control-label">所在城市</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="city" name="city" ng-model="region.city" placeholder="所在城市" />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.star_count.$dirty && regions_creat_form.star_count.$valid && !regions_creat_form.star_count.$focused, 'has-error': regions_creat_form.star_count.$dirty && regions_creat_form.star_count.$invalid && !regions_creat_form.star_count.$focused}">
                    <label for="star_count" class="col-sm-2 control-label">点赞次数</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="star_count" name="star_count" ng-model="region.star_count" placeholder="点赞次数" />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.lng.$dirty && regions_creat_form.lng.$valid && !regions_creat_form.lng.$focused, 'has-error': regions_creat_form.lng.$dirty && regions_creat_form.lng.$invalid && !regions_creat_form.lng.$focused}">
                    <label for="lng" class="col-sm-2 control-label">经度</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="lng" name="lng" ng-model="region.lng" placeholder="经度" /> <a href="http://lbs.amap.com/console/show/picker" target="_blank">高德坐标拾取系统</a>
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.lat.$dirty && regions_creat_form.lat.$valid && !regions_creat_form.lat.$focused, 'has-error': regions_creat_form.lat.$dirty && regions_creat_form.lat.$invalid && !regions_creat_form.lat.$focused}">
                    <label for="lat" class="col-sm-2 control-label">纬度</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="lat" name="lat" ng-model="region.lat" placeholder="x坐标" />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.buffer_distance.$dirty && regions_creat_form.buffer_distance.$valid && !regions_creat_form.buffer_distance.$focused, 'has-error': regions_creat_form.buffer_distance.$dirty && regions_creat_form.buffer_distance.$invalid && !regions_creat_form.buffer_distance.$focused}">
                    <label for="buffer_distance" class="col-sm-2 control-label">坐标有效范围</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="buffer_distance" name="buffer_distance" ng-model="region.buffer_distance" placeholder="坐标有效范围(整数，单位为米)" />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.min_visitor_count.$dirty && regions_creat_form.min_visitor_count.$valid && !regions_creat_form.min_visitor_count.$focused, 'has-error': regions_creat_form.min_visitor_count.$dirty && regions_creat_form.min_visitor_count.$invalid && !regions_creat_form.min_visitor_count.$focused}">
                    <label for="lat" class="col-sm-2 control-label">最小成团人数</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="min_visitor_count" name="min_visitor_count" ng-model="region.min_visitor_count" placeholder="最小成团人数" />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.max_visitor_count.$dirty && regions_creat_form.max_visitor_count.$valid && !regions_creat_form.max_visitor_count.$focused, 'has-error': regions_creat_form.max_visitor_count.$dirty && regions_creat_form.max_visitor_count.$invalid && !regions_creat_form.max_visitor_count.$focused}">
                    <label for="lat" class="col-sm-2 control-label">最大成团人数</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="max_visitor_count" name="max_visitor_count" ng-model="region.max_visitor_count" placeholder="最大成团人数" />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.presale.$dirty && regions_creat_form.presale.$valid && !regions_creat_form.presale.$focused, 'has-error': regions_creat_form.presale.$dirty && regions_creat_form.presale.$invalid && !regions_creat_form.presale.$focused}">
                    <label for="lat" class="col-sm-2 control-label">预售期</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" id="presale" name="presale" ng-model="region.presale" placeholder="预售期(天)" />
                    </div>
                </div>
                <div class="form-group" ng-class="{'has-success': regions_creat_form.region_type.$dirty && regions_creat_form.region_type.$valid && !regions_creat_form.region_type.$focused, 'has-error': regions_creat_form.region_type.$dirty && regions_creat_form.region_type.$invalid && !regions_creat_form.region_type.$focused}">
                    <label for="lat" class="col-sm-2 control-label">景区类型</label>
                    <div class="col-sm-9 pt7">
                        <label><input type="radio" name="region_type" value="0" ng-model="region.region_type" style="margin: 0 5px;" /> 普通</label>
                        <label><input type="radio" name="region_type" value="1" ng-model="region.region_type" style="margin: 0 5px 0 15px;" /> 散拼</label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">景区封面</label>
                    <div class="col-sm-9 pt7">
                        <div class="img-content" style="margin-bottom: 10px;" ng-if="region.cover_image != null && region.cover_image != ''">
                            <span class="pull-left">原封面：</span><img ng-src="{{region.cover_image}}?imageView2/2/w/100/h/100" width="100" height="100" />
                        </div>
                        <uploader-img val="region.cover_image"></uploader-img>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">景区缩略图</label>
                    <div class="col-sm-9 pt7">
                        <div class="img-content-thumb" style="margin-bottom: 10px;" ng-if="region.thumbnail != null && region.thumbnail != ''">
                            <span class="pull-left">原缩略图：</span><img ng-src="{{region.thumbnail}}?imageView2/2/w/100/h/100" width="100" height="100" />
                        </div>
                        <uploader-img val="region.thumbnail"></uploader-img>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">景区内容</label>
                    <div class="col-sm-9">
                        <textarea id="editor"></textarea>
                    </div>
                </div>
            </div>
            <div class="box-footer">
                <button type="submit" class="btn btn-primary pull-right" ng-disabled="regions_creat_form.$invalid">{{edit ? "修 改" : "创 建"}}</button>
            </div>
        </form>
    </div>
</section>